﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GBlog.Core.Entities;

namespace GBlog.Core.Mapping
{
    public class PostMap : MapBase<Post, int>
    {
        public PostMap()
        {
            ToTable("Core_Post");
            RegisterID();
            HasRequired(t => t.User).WithMany(t => t.Posts).HasForeignKey(t => t.UserID);
            Property(t => t.Title).IsRequired().HasMaxLength(128);
            Property(t => t.Seo).IsRequired().HasMaxLength(128);
            Property(t => t.Content).IsRequired();
            Property(t => t.IsPublished).IsRequired();
            Property(t => t.Published);
            Property(t => t.Views);
            RegisterDefault();
        }
    }
}